package com.wisezone.workflow.core.impl;

import org.apache.log4j.Logger;

import com.wisezone.common.mail.MailSenderService;
import com.wisezone.workflow.core.BaseProperty;
import com.wisezone.workflow.dao.WfActivityDao;
import com.wisezone.workflow.dao.WfActivityInstUserDao;
import com.wisezone.workflow.dao.WfActivityInstanceDao;
import com.wisezone.workflow.dao.WfDataDictionaryDao;
import com.wisezone.workflow.dao.WfLinkDao;
import com.wisezone.workflow.dao.WfProcessDefinitionDao;
import com.wisezone.workflow.dao.WfProcessInstanceDao;
import com.wisezone.workflow.dao.WfVariableDao;
import com.wisezone.workflow.dao.WfVariableInstanceDao;
import com.wisezone.workflow.exception.WfCoreException;


/**
 * 流程基础类
 * @author tss 2009-09-05
 *
 */
public class BasePropertyImpl implements BaseProperty{
	
	protected Logger log = Logger.getLogger(getClass());

	private WfProcessDefinitionDao wfProcessDefinitionDao;
	
	private WfProcessInstanceDao WfProcessInstanceDao;
	
	private WfActivityDao wfActivityDao;
	
	private WfActivityInstanceDao wfActivityInstanceDao;
	
	private WfLinkDao wfLinkDao;
	
	private WfVariableDao wfVariableDao;
	
	private WfVariableInstanceDao wfVariableInstanceDao;
	
	private WfDataDictionaryDao wfDataDictionaryDao;
	
	private WfActivityInstUserDao wfActivityInstUserDao;
	
	private MailSenderService wzMailSenderService;
	
	
	
	
	
	public BasePropertyImpl() {
	}

	public void setDao(BaseProperty inst){
		
		this.wfProcessDefinitionDao = inst.getWfProcessDefinitionDao();
		this.WfProcessInstanceDao = inst.getWfProcessInstanceDao();
		this.wfActivityDao = inst.getWfActivityDao();
		this.wfActivityInstanceDao = inst.getWfActivityInstanceDao();
		this.wfLinkDao = inst.getWfLinkDao();
		this.wfDataDictionaryDao = inst.getWfDataDictionaryDao();
		this.wfActivityInstUserDao = inst.getWfActivityInstUserDao();
		this.wfVariableDao = inst.getWfVariableDao();
		this.wfVariableInstanceDao = inst.getWfVariableInstanceDao();
		
	}
	
	
	
	/**
	 * 获得流程实例状态ID
	 * @param code
	 * @return
	 * @throws WfCoreException
	 */
	public Long getProcessInstState(String code) throws WfCoreException{
		
		return this.getWfDataDictionaryDao().getDataDictionaryId("processInstanceState", code);
	}
	
	/**
	 * 获得活动实例状态ID
	 * @param code
	 * @return
	 * @throws WfCoreException
	 */
	public Long getActivityInstState(String code) throws WfCoreException{
		
		return this.getWfDataDictionaryDao().getDataDictionaryId("activityInstanceState", code);
	}
	
	/**
	 * 获得活动类别ID
	 * @param code
	 * @return
	 * @throws WfCoreException
	 */
	public Long getActivityCategory(String code) throws WfCoreException{
		
		return this.getWfDataDictionaryDao().getDataDictionaryId("activityCategory", code);
	}
	
	/**
	 * 获得任务类型
	 * @param code
	 * @return
	 * @throws WfCoreException
	 */
	public Long getTaskCategory(String code) throws WfCoreException{
		
		return this.getWfDataDictionaryDao().getDataDictionaryId("taskCategory", code);
	}
	
	/**
	 * 获得流程变量类别ID
	 * @param code
	 * @return
	 * @throws WfCoreException
	 */
	public Long getVariableCategory(String code) throws WfCoreException{
		
		return this.getWfDataDictionaryDao().getDataDictionaryId("variableCategory", code);
	}

	public WfProcessDefinitionDao getWfProcessDefinitionDao() {
		return wfProcessDefinitionDao;
	}


	public void setWfProcessDefinitionDao(
			WfProcessDefinitionDao wfProcessDefinitionDao) {
		this.wfProcessDefinitionDao = wfProcessDefinitionDao;
	}


	public WfProcessInstanceDao getWfProcessInstanceDao() {
		return WfProcessInstanceDao;
	}


	public void setWfProcessInstanceDao(WfProcessInstanceDao wfProcessInstanceDao) {
		WfProcessInstanceDao = wfProcessInstanceDao;
	}


	public WfActivityDao getWfActivityDao() {
		return wfActivityDao;
	}


	public void setWfActivityDao(WfActivityDao wfActivityDao) {
		this.wfActivityDao = wfActivityDao;
	}


	public WfActivityInstanceDao getWfActivityInstanceDao() {
		return wfActivityInstanceDao;
	}


	public void setWfActivityInstanceDao(WfActivityInstanceDao wfActivityInstanceDao) {
		this.wfActivityInstanceDao = wfActivityInstanceDao;
	}


	public WfLinkDao getWfLinkDao() {
		return wfLinkDao;
	}


	public void setWfLinkDao(WfLinkDao wfLinkDao) {
		this.wfLinkDao = wfLinkDao;
	}


	public WfVariableDao getWfVariableDao() {
		return wfVariableDao;
	}


	public void setWfVariableDao(WfVariableDao wfVariableDao) {
		this.wfVariableDao = wfVariableDao;
	}


	public WfDataDictionaryDao getWfDataDictionaryDao() {
		return wfDataDictionaryDao;
	}


	public void setWfDataDictionaryDao(WfDataDictionaryDao wfDataDictionaryDao) {
		this.wfDataDictionaryDao = wfDataDictionaryDao;
	}


	public WfActivityInstUserDao getWfActivityInstUserDao() {
		return wfActivityInstUserDao;
	}


	public void setWfActivityInstUserDao(WfActivityInstUserDao wfActivityInstUserDao) {
		this.wfActivityInstUserDao = wfActivityInstUserDao;
	}

	public WfVariableInstanceDao getWfVariableInstanceDao() {
		return wfVariableInstanceDao;
	}

	public void setWfVariableInstanceDao(WfVariableInstanceDao wfVariableInstanceDao) {
		this.wfVariableInstanceDao = wfVariableInstanceDao;
	}

	public MailSenderService getWzMailSenderService() {
		return wzMailSenderService;
	}

	public void setWzMailSenderService(MailSenderService wzMailSenderService) {
		this.wzMailSenderService = wzMailSenderService;
	}

    
	

  	
	
    	
}
